<div id="p" class="easyui-panel" title="个人信息维护" style="width:550px;height:300px;padding:10px;" buttons="#grwh-buttons">
	 <h3><label> </label></h3>
     <form id="userInfo_form" class="easyui-form" method="post">
     <input type="text" name="id" style="width: 30px; display: none" />
		<table>
			<tr>
				<td>用户名 </td>
				<td><input   name="code"  
					style="width: 450px;"  class="easyui-textbox"
					data-options="validType:'length[1,200]'"   disabled="disabled" /></td></tr>
			<tr>
				<td>真实姓名:</td>
				<td><input   name="name"  
					style="width: 450px;" class="easyui-textbox"
					data-options="required:true,validType:'length[1,60]'" /></td>
			</tr>
		   
			<tr>
				<td>所属部门:</td>
				<td><select   class="easyui-combotree"
					url="api/user/getJgDeptList" name="deptId" style="width: 450px;"   disabled="disabled" ></select></td>
			</tr>
			<tr>
				<td>邮箱名:</td> 
				<td><input   name="emailAddress" style="width: 450px;"  
					class="easyui-textbox" /></td>
			</tr>
			<tr>
				<td>邮箱密码:</td> 
				<td><input   name="emailPassword" style="width: 450px;"   
					class="easyui-textbox" /></td>
			</tr>
			<tr>
				<td>所在单位:</td>
				<td><select   class="easyui-combotree"
					url="api/getallpbc" name="jgId" style="width: 450px;"  disabled="disabled" ></select></td>
			</tr>

		</table>
     </form>
  <div id="grwh-buttons" style="text-align:right;padding:15px 45px;">
    <a href="#" class="easyui-linkbutton" iconCls="icon-ok" id="saveInfo">保存</a>
	</div> 
</div>

<script type="text/javascript">
	
	$(document).ready(function (){
		$.ajax({  
	        url: 'api/login/getop',  
	        async: true, // 注意此处需要同步，因为先绑定表头，才能绑定数据  
	        type: "POST",  
	        dataType: "json",  
	        success: function (result) { 
	        	user=result.data;
	        	console.log(user.deptId);
	        $("#userInfo_form").form("load",user);
	        }
		});
	
	 $("#saveInfo").bind('click',function(){
		 var isValid =$("#userInfo_form").form('validate');
	      if(!isValid){
	          return false;
	      }
		$('#userInfo_form').form('submit',{
			url : 'api/user/edit',
			success : function(data) {
				var data = JSON.parse(data);
				//console.log(data.data);
				if (data.code == 1) {
					//console.log(data.msg);
					$.prompt(data.msg, 'prompt_opmanage');
				} else {
					$.messager.alert("提示",data.msg);
				}
			}
		})
	 })
	
	});
</script>